<template>
  <div>
    <div class="commentdetail-body">
      <div>
        <div class="displace-money" v-if="statustype==0">
          <div class="price" v-if="statustype!=2" style="font-size:0.24rem">￥</div>
          <div class="price" v-if="statustype!=2">{{money}}</div>
        </div>
        <div class="discusstime" v-if="statustype!=0">
          <span class="price" v-if="statustype!=2">￥{{money}}</span>
          <span class="outofdateprice" v-if="statustype==2">￥{{money}}</span>
        </div>
        <div v-if="commenttype==null" class="commentdetail-text" @click="reply($event,topicindex,commentindex)">
          <span class="detailcom" v-html="commenttext">{{commenttext}}</span>
        </div>

        <div v-else-if="commenttype!=null" class="commentdetail-text" @click="reply($event,topicindex,commentindex)">
          <span class="detailcom" >回复
            <span style="color: #fb685b;"> @ {{atname}} </span>: {{commenttext}}</span>
            <span class="detailcom" v-html="commenttext"></span>
        </div>
        <div v-if="isdisplacetype==2" class="displace-explain" v-html="description">
          {{description}}
        </div>
        <div>
          <div v-if="piclength>0" v-model="picarray">
            <div class="commenturl">
              <img v-lazy="item.src+'?imageMogr2/auto-orient'" class="previewer-demo-img preview-img-item commentimg" :key="index" v-for="(item,index) in picarray" @click="saveimgtolocal(picarray,index)">
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="body-sep"></div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      comment: '',
      commentlist: [],
      imgstr:[],//点击跳转幸福绿城app
    }
  },
  props: ["money","statustype",'commenttext', 'piclength', 'imgurl', 'picarray', 'isdisplacetype', 'commenttype', 'commentindex', 'topicindex', 'atname', 'description'],
  methods: {
    show() {
    },
    reply(event, topicindex, commentindex) {
      this.$emit("replycomment", { event: event, topicindex: topicindex, commentindex: commentindex })
    },
    saveimgtolocal(imgarray,index){
      this.imgstr=[];
      _each(imgarray,(v,i)=>{
        this.imgstr.push(v.src);
      })
      window.location.href= "image://?url=" + this.imgstr + "&currentIndex=" + index;
    }
  }
}
</script>
<style scoped>
.commentdetail-body {
  display: flex;
  flex-direction: column;
  padding: 0 0.25rem 0.2rem 0.27rem;
}

.commentdetail-text {
  font-size: 0.32rem;
  color: #333333;
  line-height: 0.42rem;
  width: 6.9rem;
}

.commenturl {
  margin-top: 0.2rem;
  width: 7rem;
}

.commentimg {
  width: 100%;
  display: inline-block;
  margin-right: 0.2rem;
  margin-bottom: 0.1rem;
}

td {
  padding: 0;
  margin: 0;
}

.displace-explain {
  padding-top: 0.05rem;
  font-size: 0.24rem;
  color: #494949;
  font-family: "PingFangSC Regular";
  line-height: 0.42rem;
}

.body-sep {
  width: 6.9rem;
  margin-left: 0.3rem;
  height: 1px;
  background-color: #E6E6E6;
}
  .outofdateprice{
    padding-right: 0.13rem;
    padding-top: 0.25rem;
    font-size: 0.24rem;
    color: #999999;
  }
  .outofdate{
    max-height: 0.8rem;
   background: #ffffff;
   position: absolute;
   right: 0.45rem;
  }
    .sold{
   max-height: 0.8rem;
   background: #ffffff;
   position: absolute;
   right: 0.45rem;
  }
  .sold span{
    color: white;
  }
  .price{
    padding-top: 0.2rem;
    padding-bottom: 0.1rem;
    font-size: 0.32rem;
    color: #DC4B4E;
    font-family: Arial;
  }
    .displace-money{
    display: flex;
  }
  .discusstime{
    position: relative;
    display: flex;
  }
</style>
